﻿<cfsilent>
	<cfscript>
		
		event.setArg("pageTitle", "教学运行 - 教学场地调度 - 预约明细");
		
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		
		docId = event.getArg("DOCID");
		
		/* 读取预约信息 */
		sql = "SELECT 
					a.use_time, a.use_rooms, a.proc_stat, 
					a.tch_approve, a.time_review, 
					a.tch_cancel, a.time_cancel, 
					b.tch_id, b.tch_name, 
					c.institute_name, 
					d.ut_id, d.usage
				FROM t_clsroom_borrow a 
					INNER JOIN t_teacher b ON b.tch_id = a.tch_id 
					INNER JOIN t_institute c ON c.institute_id = a.institute_id 
					INNER JOIN t_clsroom_usetype d ON d.ut_id = a.ut_id 
				WHERE 
					a.cbr_id = :docId ";

		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="docId", value=docId, cfsqltype="cf_sql_char" );

		rs_doc = queryObj.execute( sql=sql ).getResult();
		
		currentTab = event.getArg("Tab", "labDetail");
		
		passArgs = structNew();
		structInsert( passArgs, "DOCID", docId );
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('classRoomUsageRecord')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">教室预约记录</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 info"></i>教室使用预约明细
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
			
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labDetail">class="active"</cfif> id="labDetail" tabTarget="Detail">回执单</span>
						<cfif rs_doc.proc_stat eq "S" >
							<span <cfif currentTab eq "labCancel">class="active"</cfif> id="labCancel" tabTarget="Cancel">取消预约</span>
						</cfif>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>

				<div id="Detail" class="tabContent">

					<div class="noticeBlock">
						<cfif rs_doc.proc_stat eq "S" >
							<div class="operation">
								<a class="uiButton" target="_blank" href="<cfoutput>#buildURL('classRoomBorrowPrintReceipt', passArgs)#</cfoutput>"><i class="mrs img btnPrint"></i><span class="uiButtonText">打印调度单</span></a>
							</div>
							<h3>教室调度单</h3>
							<p><span class="img icon16x16 message"></span>该教室借用申请已处理完毕. 请打印回执单, 并转交申请人.</p>
						</cfif>
						<cfif rs_doc.proc_stat eq "C" >
							<h3>预约申请</h3>
						</cfif>
						<hr/>
					</div>
				
					<div class="UIDashBoard">
						
						<div class="col2">
						
							<div class="noticeBlock">
							
								<p>用于<cfoutput>#rs_doc.usage#</cfoutput></p>
								<ol>
									<li>责任单位: <cfoutput>#rs_doc.institute_name#</cfoutput></li>
									<li>负责人: <cfoutput>#rs_doc.tch_name#</cfoutput>(<cfoutput>#rs_doc.tch_id#</cfoutput>)</li>
									<li><cfoutput>#rs_doc.use_time#</cfoutput>，<cfoutput>#rs_doc.use_rooms#</cfoutput></li>
								</ol>
							
							</div>
						
						</div>
					
						<div class="col2 last">
							
							<cfif rs_doc.proc_stat eq "S" >
							
								<div class="noticeBlock">

									<h3>回执单号</h3>
									<p>
										<span class="img icon16x16 message"></span>
										该回执单号仅用于核查教室借用申请及用途信息
									</p>
									<p>审批人: <cfoutput>#rs_doc.tch_approve#</cfoutput></p>
									<br/>
									<p><img src="<cfoutput>#getContextRoot()#</cfoutput>/barcode/Progress/JSDD-<cfoutput>#rs_doc.ut_id#</cfoutput>-<cfoutput>#docId#</cfoutput>.png" /></p>
							
								</div>
							
							</cfif>
							
							<cfif rs_doc.proc_stat eq "C" >
								
								<div class="systemNotice">
									
									<h3>预约已撤销</h3>
									<p class="mln">该预约申请已由 <cfoutput>#rs_doc.tch_cancel#</cfoutput> 在 <em><cfoutput>#datetimeAdvice.formatDateString( rs_doc.time_cancel )#</cfoutput></em> 执行取消操作</p>
									
								</div>
								
							</cfif>
						
						</div>
					
					</div>
				
				</div>
				
				<div id="Cancel" class="tabContent">
					
					<div class="noticeBlock">
						<h3>取消预约记录</h3>
						<p><span class="img icon16x16 message"></span>如果进行了错误的借用或审批操作, 可以在这里进行取消, 并释放已预约的教室资源.</p>
						<hr/>
					</div>
					
					<div class="systemNotice">
						<h3><span class="img icon16x16 info"></span>取消预约</h3>
						<p>如果您取消了该项预约记录, 该预约时段所有已借出的教室资源会同时取消, 用于自由借用.</p>
					
						<form id="formRemove" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('classRoomUsageRecordCancelDo')#</cfoutput>">
							<input type="hidden" name="DOCID" value="<cfoutput>#docId#</cfoutput>" />
							<div class="lable"><input class="button2" type="submit" value="取消预约" /></div>
						</form>
					</div>
					
				</div>

			</div>
		</li>
	</ul>
</div>